'use strict';
/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  // 上传
  router.post('/api/upload', controller.uploadcos.file);
  // 登录
  router.post('/api/user/login', controller.user.login);
  // 用户、角色、菜单
  // updateUserRoles

  router.post('/api/user/updateUserRoles', controller.user.updateUserRoles);
  router.get('/api/user/getUserRoles', controller.user.getUserRoles);
  router.get('/api/user/getUserInfo', controller.user.getUserInfo);
  router.resources('user', '/api/user', controller.user);
  router.get('/api/role/list', controller.role.allList);
  router.resources('role', '/api/role', controller.role);
  router.get('/api/menu/list', controller.menu.allList);
  router.resources('menu', '/api/menu', controller.menu);

  // banner
  router.get('/api/banner/list', controller.banner.allList);
  router.resources('banner', '/api/banner', controller.banner);
  // category
  router.get('/api/category/list', controller.category.allList);
  router.resources('category', '/api/category', controller.category);
  // product
  router.get('/api/product/list', controller.product.allList);
  router.resources('product', '/api/product', controller.product);

  router.post('/api/tiia/searchImage', controller.tiia.searchImage);
};
